package view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import controllers.*;
import constants.*;
import java.util.Date;
public class StatusBar extends JPanel{

	public StatusBar(){
		setPreferredSize(new Dimension(0, 40));
		setBorder(BorderFactory.createLineBorder(Color.GRAY));
		
		initUI();
	}
	
	public void initUI(){
		setLayout(new FlowLayout(FlowLayout.RIGHT, 20, 10));
		
		JTextField lbEmpty = new JTextField(new Integer(RoomController.countRoomByStatus(Constants.EMPTY)).toString()); 
		lbEmpty.setEditable(false);
		add(new JLabel("Phòng trống"));
		add(lbEmpty);
		
		JTextField lbIn = new JTextField(new Integer(RoomController.countRoomByStatus(Constants.BOOKING)).toString());
		lbIn.setEditable(false);
		add(new JLabel("Đã đặt"));
		add(lbIn);
		
		JTextField lbBook = new JTextField(new Integer(RoomController.countRoomByStatus(Constants.CHECKIN)).toString());
		lbBook.setEditable(false);
		add(new JLabel("Đang thuê"));
		add(lbBook);
		
		JTextField lbDate = new JTextField(new Date().toString());
		lbDate.setEditable(false);
		add(new JLabel("Ngày"));
		add(lbDate);
	}
}
